package com.example.myinitializrspringbootapp.WebFilter;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/*@Configuration
@WebFilter(urlPatterns = "/html/*",filterName = "WebFilter")
@Order(1)   //注解主要用于多个过滤器时定义执行顺序,值越小越先执行*/
public class WebTestFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        //初始化
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //请求
        System.out.println("WebTestFilter");
        filterChain.doFilter(servletRequest,servletResponse);
    }

    @Override
    public void destroy() {
        //销毁
    }
}
